package org.mbds.wolf.android.idgo800;

import com.gemalto.idgo800.IDGoErrors;
/**
 * 
 * @author alesas
 *
 */
public class IDGo800Exception extends Exception {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -1018074218598324491L;

	/**
	 * @Constructor IDGo800Exception
	 * @param errorNumber int
	 */
	public IDGo800Exception(int errorNumber)
	{
		super(getErrorMessage(errorNumber));
	}
	
	/**
	 * getErrorMessage
	 * @param errorNumber
	 * @return message String
	 */
	public static String getErrorMessage(int errorNumber)
	{
		switch(errorNumber)
		{
		case Constants.ERR_TIMEOUT:
			return Constants.ERR_MSG_TIME_OUT;
			
		case Constants.ERR_ACTION_NOT_FOUND:
			return Constants.ERR_MSG_ACTION_NOT_FOUND;
			
			case IDGoErrors.GE_BAD_ARGUMENT:
				return Constants.ERR_MSG_GE_BAD_ARGUMENT;
				
			case IDGoErrors.GE_BLE_PAIRING_FAILED:
				return Constants.ERR_MSG_GE_BLE_PAIRING_FAILED;
				
			case IDGoErrors.GE_BT_ADAPTER_DISABLED:
				return Constants.ERR_MSG_GE_BT_ADAPTER_DISABLED;
				
			case IDGoErrors.GE_BUFFER_TOO_SMALL:
				return Constants.ERR_MSG_GE_BUFFER_TOO_SMALL;
				
			case IDGoErrors.GE_DIRECTORY_EXISTS:
				return Constants.ERR_MSG_GE_DIRECTORY_EXISTS;
				
			case IDGoErrors.GE_DIRECTORY_NOT_FOUND:
				return Constants.ERR_MSG_GE_DIRECTORY_NOT_FOUND6;
				
			case IDGoErrors.GE_FILE_EXISTS:
				return Constants.ERR_MSG_GE_FILE_EXISTS;
				
			case IDGoErrors.GE_FILE_NOT_FOUND:
				return Constants.ERR_MSG_GE_FILE_NOT_FOUND;
				
			case IDGoErrors.GE_INVALID_CONTAINER_INDEX:
				return Constants.ERR_MSG_GE_INVALID_CONTAINER_INDEX;
				
			case IDGoErrors.GE_INVALID_SESSION_ID:
				return Constants.ERR_MSG_GE_INVALID_SESSION_ID;
				
			case IDGoErrors.GE_NO_LICENSE:
				return Constants.ERR_MSG_GE_NO_LICENSE;
				
			case IDGoErrors.GE_NO_SERVICE:
				return Constants.ERR_MSG_GE_NO_SERVICE;
				
			case IDGoErrors.GE_NO_SESSION_AVAILABLE:
				return Constants.ERR_MSG_GE_NO_SESSION_AVAILABLE;
				
			case IDGoErrors.GE_NOT_SUPPORTED:
				return Constants.ERR_MSG_GE_NOT_SUPPORTE;
				
			case IDGoErrors.GE_NULL_ARGUMENT:
				return Constants.ERR_MSG_GE_NULL_ARGUMENT;
				
			case IDGoErrors.GE_OK:
				return Constants.ERR_MSG_GE_OK;
				
			case IDGoErrors.GE_OUT_OF_RANGE_ARGUMENT:
				return Constants.ERR_MSG_GE_OUT_OF_RANGE_ARGUMENT;
				
			case IDGoErrors.GE_PIN_POLICY_1:
				return Constants.ERR_MSG_GE_PIN_POLICY_1;
				
			case IDGoErrors.GE_PIN_POLICY_10:
				return Constants.ERR_MSG_GE_PIN_POLICY_10;
				
			case IDGoErrors.GE_PIN_POLICY_2:
				return Constants.ERR_MSG_GE_PIN_POLICY_2;
				
			case IDGoErrors.GE_PIN_POLICY_3:
				return Constants.ERR_MSG_GE_PIN_POLICY_3;
				
			case IDGoErrors.GE_PIN_POLICY_4:
				return Constants.ERR_MSG_GE_PIN_POLICY_4;
				
			case IDGoErrors.GE_PIN_POLICY_5:
				return Constants.ERR_MSG_GE_PIN_POLICY_5;
				
			case IDGoErrors.GE_PIN_POLICY_6:
				return Constants.ERR_MSG_GE_PIN_POLICY_6;
				
			case IDGoErrors.GE_PIN_POLICY_7:
				return Constants.ERR_MSG_GE_PIN_POLICY_7;
				
			case IDGoErrors.GE_PIN_POLICY_8:
				return Constants.ERR_MSG_GE_PIN_POLICY_8;
				
			case IDGoErrors.GE_PIN_POLICY_9:
				return Constants.ERR_MSG_GE_PIN_POLICY_9;
				
			case IDGoErrors.GE_TRANSACTION_INVALID_ID:
				return Constants.ERR_MSG_GE_TRANSACTION_INVALID_ID;
				
			case IDGoErrors.GE_TRANSACTION_LOCKED:
				return Constants.ERR_MSG_GE_TRANSACTION_LOCKED;
				
			case IDGoErrors.GE_UI_CANCELLED_BY_USER:
				return Constants.ERR_MSG_GE_UI_CANCELLED_BY_USER;
				
			case IDGoErrors.GE_UI_PIN_CONF_WRONG:
				return Constants.ERR_MSG_GE_UI_PIN_CONF_WRONG;
				
			case IDGoErrors.GE_UI_TIMEOUT:
				return Constants.ERR_MSG_GE_UI_TIMEOUT;
				
			case IDGoErrors.GE_UNAUTHORIZED_ACCESS:
				return Constants.ERR_MSG_GE_UNAUTHORIZED_ACCESS;
				
			case IDGoErrors.GE_UNKNOWN:
				return Constants.ERR_MSG_GE_UNKNOWN;
				
			case IDGoErrors.GE_WRONG_APP_SIGNATURE:
				return Constants.ERR_MSG_GE_WRONG_APP_SIGNATURE;
				
			default: return Constants.ERR_MSG_UNKNOWN;
		}
	}
}
